package com.qf.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qf.bean.Training;
import com.qf.dao.TrainingMapper;
import com.qf.service.FanKuiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.HashMap;
import java.util.List;

/**
 * IntelliJ IDEA -> person
 * 2019/11/28 8:46
 *
 * @author zmyao
 * 别看，我是渣渣。
 */
@Service
public class FanKuiServiceImpl  implements FanKuiService {
@Autowired
private TrainingMapper trainingMapper;
    @Override
    public PageInfo<Training> findAllByOpintion(int pageIndex, int pageSize, String trainingname, String trainingdateStart, String trainingdateEnd, String auditopinion) {
        PageHelper.startPage(pageIndex,pageSize);
        HashMap map = new HashMap();
        map.put("trainingname",trainingname);
        map.put("trainingdateStart",trainingdateStart);
        map.put("trainingdateEnd",trainingdateEnd);
        map.put("auditopinion",auditopinion);
        List<Training> trainings = trainingMapper.findall(map);
        PageInfo<Training> pageInfo = new PageInfo<>(trainings);
        return pageInfo;
    }
}
